package com.xjgc.timer;

import com.xjgc.sap.ws.service.ZxjEip2CService;
import com.xjgc.sap.ws.service.ZxjMes2SapService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;

/**
 * 定时器任务
 */

public class ZxjMes2SapTask{

	@Autowired
	ZxjMes2SapService zxjMes2SapService;
	@Autowired
	ZxjEip2CService zxjEip2CService;


	private static boolean isRunning = false;
	private static final Logger LOG = LoggerFactory.getLogger(ZxjMes2SapTask.class);
	//每隔5分钟执行一次
	@Scheduled(fixedRate = 5*60*1000)
	public void tasks() {
		if(!isRunning){
			isRunning = true;
			LOG.info("开始执行指定任务！");
			zxjMes2SapService.getData();
			zxjEip2CService.update2CpzsnData();
			zxjEip2CService.update2CvbelnData();
			isRunning = false;
			LOG.info("指定任务执行结束");
		}
	}


}
